﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;

namespace Marmat.Forms.Skin
{
    partial class Switch
    {
        /// <summary>
        /// 默认大小
        /// </summary>
        protected override Size DefaultSize => new Size(48, 23);


        /// <summary>
        /// 获取或设置未选中时背景色
        /// </summary>
        [Category("样式"), Description("获取或设置未选中时背景色")]
        [DefaultValue(typeof(Color), "144, 147, 153")]
        public Color UnselectedColor
        {
            get => _backColor;
            set
            {
                _backColor = value;
                this.Invalidate();
            }
        }
        private Color _backColor = Configuration.DefaultTheme.Info;

        /// <summary>
        /// 选中时背景色
        /// </summary>
        [Category("样式"), Description("选中时背景色")]
        [DefaultValue(typeof(Color), "103, 194, 58")]
        public Color SelectedColor
        {
            get => this._selectedColor;
            set
            {
                this._selectedColor = value;
                this.Invalidate();
            }
        }
        private Color _selectedColor = Configuration.DefaultTheme.Success;

        /// <summary>
        /// 圆角的程度
        /// </summary>
        [Category("样式"), Description("圆角的程度(不能查过自身高度的一半)")]
        [DefaultValue(0)]
        public int Circle
        {
            get => this._circle; set
            {
                if (value != this._circle)
                {
                    value = Math.Max(value, 0);
                    int num = Math.Min(this.Height, this.Width) / 2;
                    if (value > num)
                        value = num;
                    this._circle = value;
                    this.Invalidate();
                }
            }
        }
        private int _circle;

        [Category("样式"), Description("间隔")]
        [DefaultValue(2)]
        public int Interval
        {
            get => _interval;
            set
            {
                if (value != _interval)
                {
                    value = Math.Max(value, 0);

                    _interval = Math.Min(this.Height / 2, value);
                    this.Invalidate();
                }
            }
        }
        private int _interval = 2;


        /// <summary>
        /// 获取或设置一个值，该值指示 System.Windows.Forms.CheckBox 是否处于选中状态。
        /// </summary>
        [Category("样式"), Description("获取或设置一个值，该值指示 System.Windows.Forms.CheckBox 是否处于选中状态。")]
        [DefaultValue(false)]
        public bool Checked
        {
            get => this._clecked;
            set
            {
                this._clecked = value;
                this.Invalidate();
            }
        }
        private bool _clecked;
    }
}
